/**
 * 
 */
package com.cqan.survey.controller;

import static com.cqan.common.ViewName.*;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.cqan.controller.BaseController;
import com.cqan.orm.PropertyFilter;
import com.cqan.survey.entity.Survey;
import com.cqan.survey.service.SurveyService;

/**
 * @Description 调查控制器
 * @author slaton.wu@gmail.com
 * @date 2012-7-20上午10:38:39
 */
@Controller
@RequestMapping("/survey")
public class SurveyController extends BaseController<Survey> {
	
	@Resource(name="surveyService")
	private SurveyService surveyService;
	
	@RequestMapping(value="/list.htm")
	public ModelAndView list(Integer pageNo,HttpServletRequest request){
		ModelAndView mav = new ModelAndView(SURVEY_LIST);
		List<PropertyFilter> filters = PropertyFilter.buildFromHttpRequest(request);
		page.setOrderBy("createTime,updateTime");
		page.setOrder("desc,desc");
		page.setPageNo(pageNo);
		page = surveyService.search(page, filters);
		mav.addObject("page", page);
		return mav;
	}
}
